/*
 * @Author: MarioGo
 * @Date: 2021-11-11 13:33:50
 * @LastEditTime: 2021-11-11 13:33:50
 * @LastEditors: MarioGo
 * @Description: 文件描述
 * @FilePath: /zheye/src/helper.ts
 * 可以输入预定的版权声明、个性签名、空行等
 */
import { ImageProps } from './store';

export function generateFitUrl(
  data: ImageProps,
  width: number,
  height: number,
  format = ['m_pad'],
): void {
  if (data && data.url) {
    const formatStr = format.reduce((prev, current) => {
      return current + ',' + prev;
    }, '');
    data.fitUrl = data.url + `?x-oss-process=image/resize,${formatStr}h_${height},w_${width}`;
  }
}
